package com.smart.daotest;

import com.smart.dao.CalenderAdao;
import com.smart.domain.CalenderA;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.testng.annotations.Test;

import java.util.Date;

@ContextConfiguration("classpath*:/Room-context.xml")

@Rollback(false)
public class Testcalender extends AbstractTransactionalTestNGSpringContextTests {


    @Autowired
    private CalenderAdao calenderAdao;

    @Test
    public void testaddcal(){
        CalenderA calenderA =new CalenderA();
        Date date1 =new Date(119,2,7);
        Date date2 =new Date(119,6,7);
        calenderA.setTerm(2);
        calenderA.setWeek(19);
        calenderA.setStartday(date1);
        calenderA.setStopday(date2);
        calenderAdao.addCalen(calenderA);
    }

    @Test
    public void testupdatecal(){

        CalenderA calenderA =new CalenderA();
        calenderA.setTerm(1);
        calenderA.setWeek(18);
        Date date1 =new Date(116,9,03);
        Date date2 =new Date(117,2,26);

        calenderA.setStartday(date1);
        calenderA.setStopday(date2);
        calenderAdao.updateCalen(calenderA);
    }
     @Test
    public  void testdeletecal(){
         CalenderA calenderA =new CalenderA();
         Date date1 =new Date(119,2,7);
         calenderA.setStartday(date1);
         calenderAdao.deleteCalen(calenderA);
     }
        @Test
    public  void testquerycal(){
            CalenderA calenderA =new CalenderA();
            Date date1 =new Date(119,2,7);
            calenderA.setStartday(date1);
            calenderAdao.querycalen(calenderA);

        }

        @Test
    public  void testquerycallist(){
            CalenderA calenderA =new CalenderA();
            calenderAdao.querycalenlist(calenderA);
        }

}
